package achi.community.irla.beans;

import achi.community.irla.database.DatabaseImpl;
import achi.community.irla.database.ModelBean;
import achi.community.irla.entities.Achievements;
import achi.community.irla.entities.Users;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.CustomScoped;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;

/**
 * <p>The TextFieldsBean class is the backing bean for the Text Entry
 * demonstration. It is used to store the values of the input fields.</p>
 */

@ManagedBean
@RequestScoped
//@ManagedBean(name="settingsBackBean")
//@CustomScoped(value = "#{window}")
//@ManagedBean
//@RequestScoped
public class NewsBackBean implements Serializable{
    /**
     * The different kinds of text input fields.
     */

    //Settings
    @ManagedProperty(value = "#{modelBean}")
    ModelBean modelBean;

    @EJB
    DatabaseImpl db;

    private HashMap<String,Achievements> news;

    public ModelBean getModelBean() {
        return modelBean;
    }

    public void setModelBean(ModelBean modelBean) {
        this.modelBean = modelBean;
    }
    
    public HashMap<String,Achievements> getNews() {
        Long id = modelBean.getUser().getId();
        HashMap<String,Achievements> map = db.getUserTargets(id);
        return map;
    }

    public void setNews(HashMap<String,Achievements> news) {
        this.news = news;
    }
}